unit wbOracleDataset;

interface

uses
  Windows, System.SysUtils, System.Classes,
  DBClient, Provider,
  Oracle, OracleData;

type

  TwbOracleDataset = class(TOracleDataset)
  private
    FDatasetProvider: TDatasetProvider;
    FClientDataSet: TClientDataSet;
    //function GetClientDataSet: TClientDataSet;
    //function GetDatasetProvider: TDatasetProvider;
    { Private declarations }
  protected
    { Protected declarations }
  public
    { Public declarations }
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    function ClientDataset: TClientDataSet;
    procedure Close;
  published
    { Published declarations }
    //property DatasetProvider: TDatasetProvider read GetDatasetProvider;
    //property ClientDataSet: TClientDataSet read GetClientDataSet;
  end;

implementation

{ TSQLQuery2 }

function TwbOracleDataset.ClientDataset: TClientDataSet;
begin
  Close;
  FClientDataSet.Close;
  Open;
  FClientDataSet.Open;
  Result := FClientDataSet;
end;

procedure TwbOracleDataset.Close;
begin
  FClientDataSet.Close;
  inherited;
end;

constructor TwbOracleDataset.Create(AOwner: TComponent);
begin
  inherited;

  FClientDataSet := TClientDataSet.Create(Self);
  FClientDataSet.Name := Self.Name + 'Dataset';
  FClientDataSet.FetchOnDemand := True;
  // Include blobs with lengths <= MaxInt
  // IncludeBlobsInDelta(FClientDataSet, MaxInt);

  FDatasetProvider := TDatasetProvider.Create(Self);
  FDatasetProvider.Name := Self.Name + 'Provider';
  FDatasetProvider.Options := FDatasetProvider.Options + [poIncFieldProps];

  FClientDataSet.ProviderName := FDatasetProvider.Name;
  FDatasetProvider.DataSet := Self;
end;


destructor TwbOracleDataset.Destroy;
begin
  FClientDataSet.Free;
  FDatasetProvider.Free;
  inherited;
end;

{
function TwbOracleDataset.GetClientDataSet: TClientDataSet;
begin
  Result := FClientDataSet;
end;

function TwbOracleDataset.GetDatasetProvider: TDatasetProvider;
begin
  Result := FDatasetProvider;
end;
}
end.
